From: Marco Trevisan (TreviƱo) Date: Thu, 4 Dec 2025 04:14:23 +0000 (+0100) Subject: environment: Generalize easeActorProperty to animatable case X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~53 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c33d729ba31cf5ab7d9f3cee78eb0f527df3c577;p=gnome-shell.git environment: Generalize easeActorProperty to animatable case We're not handling actors only with it but also St.Adjustment that is a Clutter.Animatable, so let's name it for what it is, and adjust the parameter so that its type is not given for granted Part-of: --- diff --git a/js/ui/environment.js b/js/ui/environment.js index 58114b0a7..369f9de49 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -163,7 +163,7 @@ function _easeActor(actor, params) { callback(true); } -function _easeActorProperty(actor, propName, target, params) { +function _easeAnimatableProperty(animatable, propName, target, params) { params = { repeatCount: 0, autoReverse: false, @@ -199,7 +199,7 @@ function _easeActorProperty(actor, propName, target, params) { // Copy Clutter's behavior for implicit animations, see // should_skip_implicit_transition() - if (actor instanceof Clutter.Actor && !actor.mapped) + if (animatable instanceof Clutter.Actor && !animatable.mapped) duration = 0; const prepare = () => { @@ -213,10 +213,10 @@ function _easeActorProperty(actor, propName, target, params) { const callback = _makeEaseCallback(params, cleanup); // cancel overwritten transition - actor.remove_transition(propName); + animatable.remove_transition(propName); if (duration === 0) { - const [obj, prop] = _getPropertyTarget(actor, propName); + const [obj, prop] = _getPropertyTarget(animatable, propName); if (!isReversed) obj[prop] = target; @@ -227,7 +227,7 @@ function _easeActorProperty(actor, propName, target, params) { return; } - const pspec = actor.find_property(propName); + const pspec = animatable.find_property(propName); const transition = new Clutter.PropertyTransition({ property_name: propName, interval: new Clutter.Interval({value_type: pspec.value_type}), @@ -236,7 +236,7 @@ function _easeActorProperty(actor, propName, target, params) { auto_reverse: autoReverse, ...params, }); - actor.add_transition(propName, transition); + animatable.add_transition(propName, transition); transition.set_to(target); @@ -303,12 +303,12 @@ Clutter.Actor.prototype.ease = function (props) { _easeActor(this, props); }; Clutter.Actor.prototype.ease_property = function (propName, target, params) { - _easeActorProperty(this, propName, target, params); + _easeAnimatableProperty(this, propName, target, params); }; St.Adjustment.prototype.ease = function (target, params) { // we're not an actor of course, but we implement the same // transition API as Clutter.Actor, so this works anyway - _easeActorProperty(this, 'value', target, params); + _easeAnimatableProperty(this, 'value', target, params); }; Clutter.Actor.prototype[Symbol.iterator] = function* () {